home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
414_01
/
default.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-15
|
24KB
|
686 lines
/***********************************************************************/
/* DEFAULT.C - Default settings and profile processing */
/***********************************************************************/
/*
* THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
* Copyright (C) 1991-1993 Mark Hessling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to:
*
* The Free Software Foundation, Inc.
* 675 Mass Ave,
* Cambridge, MA 02139 USA.
*
*
* If you make modifications to this software that you feel increases
* it usefulness for the rest of the community, please email the
* changes, enhancements, bug fixes as well as any and all ideas to me.
* This software is going to be maintained and enhanced as deemed
* necessary by the community.
*
* Mark Hessling email: M.Hessling@gu.edu.au
* 36 David Road Phone: +61 7 849 7731
* Holland Park Fax: +61 7 875 5314
* QLD 4121
* Australia
*/
/*
$Header: C:\THE\RCS\default.c 1.4 1993/09/01 16:26:04 MH Interim MH $
*/
#include <stdio.h>
#include "the.h"
#include "proto.h"
/*#define DEBUG 1*/
/*--------------------------- extern data -----------------------------*/
extern WINDOW *foot;
extern VIEW_DETAILS *vd_current,*vd_first;
extern char current_screen;
extern SCREEN_DETAILS screen[MAX_SCREENS]; /* screen structures */
extern char display_screens; /* number of screens */
extern bool horizontal;
extern char current_file; /* pointer to current file */
extern LINE *next_line,*curr_line;
extern char *rec;
extern char in_profile; /* indicates if processing profile */
extern char number_of_views; /* number of files */
extern char number_of_files; /* number of open files */
/*--------------------------- global data -----------------------------*/
char CMD_LINEx;
char ERROR_ROWx;
char TAB_ROWx;
char TAB_ONx;
char SCALE_ROWx;
char SCALE_ONx;
char PREFIXx;
char CURRENT_ROW_POSx;
char STAYx;
char HEXx;
char NEWLx;
char MSGMx;
char CASE_Ex;
char CASE_Lx;
char CASE_Cx;
char CASE_Sx;
char TABI_ONx;
char TABI_Nx;
char TABO_ONx;
char TABO_Nx;
char TABSx;
char CMDARROWSTABCMDx;
char CMDARROWSTABTXTx;
char CMDARROWSTABLRx;
char AUSx;
char EOLx;
unsigned short VER_STAx;
unsigned short VER_ENDx;
unsigned short VER_COLx;
unsigned short ZON_STAx;
unsigned short ZON_ENDx;
char ARB_STSx;
char ARB_CHRx;
char DISPLAY_LOWx;
char DISPLAY_HIGHx;
bool LINEND_STATUSx;
char LINEND_VALUEx;
char NONDISPx;
bool REPROFILEx;
bool CLEARSCREENx;
bool IMPMACROx;
bool IMPOSx;
bool NUMBERx;
bool BACKUPx;
bool BEEPx;
bool CLOCKx;
bool HEXDISPLAYx;
bool CAPREXXOUTx;
long CAPREXXMAXx;
/***********************************************************************/
#ifdef PROTO
void set_defaults(void)
#else
void set_defaults()
#endif
/***********************************************************************/
{
/*--------------------------- local data ------------------------------*/
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("default.c: set_defaults");
#endif
CMD_LINEx = 'B';
ERROR_ROWx = 1;
TAB_ROWx = 6;
TAB_ONx = FALSE;
SCALE_ROWx = 6;
SCALE_ONx = FALSE;
PREFIXx = PREFIX_LEFT;
CURRENT_ROW_POSx = 0;
STAYx = ON;
HEXx = OFF;
NEWLx = TRUE;
MSGMx = TRUE;
CASE_Ex = CASE_MIXED;
CASE_Lx = CASE_IGNORE;
CASE_Cx = CASE_RESPECT;
CASE_Sx = CASE_RESPECT;
LINEND_STATUSx = FALSE;
LINEND_VALUEx = '#';
NONDISPx = '#';
TABI_ONx = FALSE;
TABI_Nx = 8;
TABO_ONx = FALSE;
TABO_Nx = 8;
TABSx = 8;
CMDARROWSTABCMDx = FALSE;
CMDARROWSTABTXTx = FALSE;
CMDARROWSTABLRx = FALSE;
BACKUPx = TRUE;
BEEPx = FALSE;
CLOCKx = TRUE;
HEXDISPLAYx = TRUE;
IMPMACROx = TRUE;
IMPOSx = TRUE;
NUMBERx = TRUE;
CAPREXXOUTx = FALSE;
CAPREXXMAXx = 1000L;
VER_STAx = 1;
VER_ENDx = max_line_length;
VER_COLx = 1;
ZON_STAx = 1;
ZON_ENDx = max_line_length;
DISPLAY_LOWx = DISPLAY_HIGHx = 0;
CLEARSCREENx = FALSE;
REPROFILEx = FALSE;
AUSx = 0;
ARB_CHRx = '?';
ARB_STSx = OFF;
#ifdef UNIX
EOLx = EOLOUT_LF;
#endif
#if defined(DOS) || defined(OS2)
EOLx = EOLOUT_CRLF;
#endif
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef PROTO
void set_default_colours(void)
#else
void set_default_colours()
#endif
/***********************************************************************/
{
/*------------------------- external data -----------------------------*/
extern bool colour_support;
/*--------------------------- local data ------------------------------*/
chtype dflt_colour[ATTR_MAX];
register int i;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("default.c: set_default_colours");
#endif
/*---------------------------------------------------------------------*/
/* Set up default colours. */
/*---------------------------------------------------------------------*/
#ifdef A_COLOR
if (colour_support)
{
init_pair(1,COLOR_WHITE,COLOR_BLUE);
init_pair(2,COLOR_WHITE,COLOR_BLUE);
init_pair(3,COLOR_BLUE,COLOR_WHITE);
init_pair(4,COLOR_RED,COLOR_WHITE);
init_pair(5,COLOR_BLACK,COLOR_CYAN);
init_pair(6,COLOR_BLUE,COLOR_WHITE);
init_pair(7,COLOR_RED,COLOR_WHITE);
init_pair(8,COLOR_BLACK,COLOR_CYAN);
init_pair(9,COLOR_BLACK,COLOR_CYAN);
init_pair(10,COLOR_RED,COLOR_WHITE);
init_pair(11,COLOR_RED,COLOR_WHITE);
init_pair(12,COLOR_WHITE,COLOR_BLUE);
init_pair(13,COLOR_WHITE,COLOR_BLUE);
init_pair(14,COLOR_RED,COLOR_WHITE);
init_pair(15,COLOR_RED,COLOR_WHITE);
init_pair(16,COLOR_BLUE,COLOR_WHITE);
init_pair(17,COLOR_RED,COLOR_WHITE);
for (i=0;i<ATTR_MAX;i++)
dflt_colour[i] = COLOR_PAIR(i+1);
dflt_colour[ATTR_CURLINE] |= A_BOLD;
dflt_colour[ATTR_TOFEOF] |= A_BOLD;
dflt_colour[ATTR_CTOFEOF] |= A_BOLD;
for (i=0;i<ATTR_MAX;i++)
if (colour[i]) /* a colour has been set up in profile */
set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
else
colour[i] = dflt_colour[i];
}
else
{
dflt_colour[ATTR_FILEAREA] = A_NORMAL; /* main window text lines */
dflt_colour[ATTR_CURLINE] = A_BOLD; /* current line */
dflt_colour[ATTR_BLOCK] = A_REVERSE; /* text in markded block */
dflt_colour[ATTR_CBLOCK] = A_BOLD | A_REVERSE;
/* current line if in marked block */
dflt_colour[ATTR_CMDLINE] = A_BOLD; /* command line */
dflt_colour[ATTR_IDLINE] = A_REVERSE; /* id line (top)*/
dflt_colour[ATTR_MSGLINE] = A_BLINK; /* message line */
dflt_colour[ATTR_ARROW] = A_BOLD; /* arrow prompt */
dflt_colour[ATTR_PREFIX] = A_BOLD; /* prefix area */
dflt_colour[ATTR_PENDING] = A_BOLD; /* pending prefix commands */
dflt_colour[ATTR_SCALE] = A_BOLD; /* scale line */
dflt_colour[ATTR_TOFEOF] = A_BOLD; /* tof eof lines */
dflt_colour[ATTR_CTOFEOF] = A_BOLD; /* current line if on t/eof lines */
dflt_colour[ATTR_TABLINE] = A_BOLD; /* tab line */
dflt_colour[ATTR_SHADOW] = A_BOLD; /* shadow lines */
dflt_colour[ATTR_STATAREA] = A_REVERSE; /* status line (bottom)*/